home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / procalctableupdate.pprx < prev    next >
Text File  |  1993-02-19  |  2KB  |  113 lines

  1. /*
  2. @BProCalcTableUpdate  @P@ICopyright Gold Disk Inc. January, 1993
  3.  
  4. Update a table previously imported from Professional Calc.
  5. */
  6. options results
  7. address command
  8. call SafeEndEdit.rexx()
  9. call ppm_AutoUpdate(0)
  10.  
  11. if ~show(l, "gdarexxsupport.library") then
  12. do
  13.         if ~addlib("gdarexxsupport.library", 0, -30) then
  14.                 exit_msg("Please install the gdarexxsupport.library in your libs: directory before running this Genie.")
  15. end
  16.  
  17. if ~show(p, "PCALC") then exit_msg("Please start Professional Calc and select a range before running this Genie.")
  18.  
  19. prefix  = ppm_GetFileName("Load Table Link Data", "",".data")
  20. if prefix   = '' then call exit_msg()
  21.  
  22. if ~open(file, prefix, "r") then
  23.     call exit_msg("Could not open file")
  24.  
  25. prefix = fcomponent(prefix)
  26.  
  27. range       = strip(readln(file))
  28. start_cell  = strip(readln(file))
  29. start_row   = strip(readln(file))
  30. end_row     = strip(readln(file))
  31. start_col   = strip(readln(file))
  32. end_col     = strip(readln(file))
  33.  
  34. call close(file)
  35.  
  36. if pos('PCALC', show('p')) = 0 then
  37.     call exit_msg("Please start ProCalc and Open appropriate Document")
  38.  
  39. address 'PCALC'
  40. 'Suppress'
  41. 'LockGUI'
  42.  
  43. 'SelectCell'    start_cell
  44.  
  45. call ppm_ShowStatus("Working..")
  46.  
  47. do  row = start_row to end_row
  48.  
  49.     do  col = start_col to end_col
  50.  
  51.         box     =   ppm_BoxNum(prefix" "col"-"row)
  52.  
  53.         if box  = 0 then iterate col
  54.  
  55.         'IsValue'
  56.  
  57.         if result = 1   then
  58.         do
  59.             'GetValue'
  60.             cell    = result
  61.         end
  62.         else
  63.         do
  64.             'GetLabel'
  65.             cell    = result
  66.         end
  67.  
  68.                 text = ppm_GetArticleText(box, 1)
  69.                 cell = left(text, skipcodes(text, 1) - 1)||cell
  70.                 call ppm_DeleteContents(box)
  71.                 call ppm_TextIntoBox(box, cell)
  72.         'Cursor' right
  73.     end
  74.  
  75.     'SelectCell' start_cell
  76.     'Cursor' down
  77.     'Current'
  78.     start_cell  = result
  79.  
  80. end
  81.  
  82. exit_msg("Done")
  83.  
  84.  
  85. exit_msg: procedure 
  86. do
  87.     parse arg message
  88.  
  89.         if show(p, "PCALC") then
  90.         do
  91.             address PCALC
  92.             'UnSuppress'
  93.             'UnLockGUI'
  94.         end
  95.  
  96.         if message ~= '' then call ppm_Inform(1, message,)
  97.         call ppm_ClearStatus()
  98.         call ppm_AutoUpdate(1)
  99.     exit
  100.  
  101. end
  102.  
  103. fcomponent: procedure
  104. do
  105.     arg filename
  106.  
  107.     slash = max(lastpos('/', filename), lastpos(':', filename))
  108.  
  109.     if slash = 0 then return(filename)
  110.     else return(substr(filename, slash + 1))
  111. end
  112.  
  113.